/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.db.VOIPCallManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.sql.SQLException;
/*    */ import java.util.List;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class SearchCustomerByPhone extends AbstractAction
/*    */ {
/* 33 */   private static Logger logger = Logger.getLogger(SearchCustomerByPhone.class
/* 34 */     .getName());
/*    */ 
/*    */   public SearchCustomerByPhone(AbstractHttpServlet servlet)
/*    */   {
/* 41 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 51 */     String phones = Util.getURLParameter(request.getParameter("phones"));
/*    */ 
/* 53 */     User loginUser = getLoginUser(request);
/*    */ 
/* 55 */     response.setContentType("text/html;charset=utf-8");
/* 56 */     PrintWriter out = response.getWriter();
/* 57 */     JSONObject jsonObject = new JSONObject();
/* 58 */     if ((phones == null) || (phones.trim().length() == 0)) {
/* 59 */       jsonObject.put("error", "1");
/* 60 */       out.println(jsonObject);
/* 61 */       out.flush();
/* 62 */       out.close();
/* 63 */       return;
/*    */     }
/*    */ 
/* 66 */     VOIPCallManager manager = new VOIPCallManager();
/*    */     try {
/* 68 */       List result = manager.getCustomerByTelephone(
/* 69 */         phones, loginUser.companyId);
/* 70 */       jsonObject.put("error", "0");
/* 71 */       jsonObject.put("result", result);
/*    */     } catch (DBException e) {
/* 73 */       jsonObject.put("error", "1");
/* 74 */       logger.warn("search customer by phone failed", e);
/*    */     } catch (SQLException e) {
/* 76 */       jsonObject.put("error", "1");
/* 77 */       logger.warn("search customer by phone failed", e);
/*    */     }
/* 79 */     out.println(jsonObject);
/* 80 */     out.flush();
/* 81 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.SearchCustomerByPhone
 * JD-Core Version:    0.6.1
 */